<?php
namespace Modules\ShopApi\Http\Controllers\v1;
use Illuminate\Http\Request;
use Modules\ShopApi\Http\Requests\IDMustBePositiveIntRequest;
use Modules\ShopApi\Http\Requests\AddCartRequest;
use Modules\ShopApi\Http\Requests\IdsRequest;
use Modules\ShopApi\Http\Requests\OrderListRequest;
use Modules\ShopApi\Models\ShopOrder as ShopOrderModel;
class OrderController extends CommonController
{
	/**
	 * @name  商品详情立即购买
	 * @method  POST
	 * @param product_id 商品id
	 * @param num 购买数量
	 * @param specs_id 商品规格id
	 * @param specs 已选规格
	 * @return  JSON
	 */
    public function add_product_order(AddCartRequest $request)
    { 
        return (new ShopOrderModel())->add_product_order($request->all());
    }
	/**
	 * @name  购物车结算
	 * @method  POST
	 * @param ids 多个购物车id  
	 * @return  JSON
	 */
    public function add_cart_order(IdsRequest $request)
    { 
        return (new ShopOrderModel())->add_cart_order($request->get('ids'));
    }
	/**
	 * @name  订单列表
	 * @method  GET	
	 * @param type 类型 0=全部，1=代付款，2=待发货，3=待收货，4=待评价，5=退款/售后
	 * @param page 页码
	 * @return  JSON
	 */
    public function order_list(OrderListRequest $request)
    { 
        return (new ShopOrderModel())->order_list($request->all());
    }
	
}
